import java.util.List;

/**
 * Created by cc
 * Description:
 * User: CZH
 * Date: 2022-11-12
 * Time: 10:41
 */
public class TestDemo {

    public static void main1(String[] args) {
        //记录时间。毫秒。
//        long stime1 = System.currentTimeMillis();
//        long etime1 = System.currentTimeMillis();
//        System.out.println(etime1-stime1);

        //记录时间。纳秒。
//        long stime1 = System.nanoTime();
//        long etime1 = System.nanoTime();
//        System.out.println(etime1 - stime1);
    }

    public static void main(String[] args) throws InterruptedException {
        TestBinaryTree tbt = new TestBinaryTree();
        Node tree1 = tbt.createTree();

        tbt.preOrderTraversalNor(tree1);
        System.out.println();
        tbt.inOrderTraversalNor(tree1);
        System.out.println();
        tbt.postOrderTraversalNor(tree1);

//        System.out.println(tbt.tree2str(tree1));

//        char[] chars1 = {'3','9','2','1','7'};
//        char[] chars2 = {'9','3','1','2','7'};
//        Node root = tbt.buildTree(chars1, chars2);
//        tbt.preOrderTraversal(root);

//        char[] chars1 = {'3','9','2','1','7'};
//        char[] chars2 = {'9','3','1','2','7'};
//        Node post = tbt.buildTreeChildPre(chars1, chars2, 0, 4);
//        tbt.preOrderTraversal(post);

//        System.out.println(tbt.lowestCommonAncestor(tree1, tree1.right, tree1.left).val);

//        String str = "abc##de#g##f###";
//        Node tree2 = tbt.createTreeForString(str);
//        tbt.inorder(tree2);

//        System.out.println(tbt.isCompleteTree(tree));

//        List<List<Character>> lists = tbt.levelOrder(tree);
//        for (List<Character> list : lists) {
//            System.out.println(list);
//        }

//        tbt.levelOrderTraversal(tree);

//        System.out.println(tbt.isSymmetric(tree));

//        System.out.println(tbt.isBalanced2(tree));

//        System.out.println(tbt.isBalanced2(tree));
//        System.out.println(tbt.isBalanced1(tree));

//        System.out.println(tbt.maxDepth(tree));

//        Node tree2 = tbt.createTree();
//        boolean subtree = tbt.isSubtree(tree, tree2);
//        System.out.println(subtree);

//        Node tree2 = tbt.createTree();
//        System.out.println(tbt.isSameTree(tree, tree2));

//        try{
//            System.out.println(tbt.find(tree, 'W').val);
//        }catch (NullPointerException e){
//            System.out.println("树中不存在该节点~");
//            e.printStackTrace();
//        }

//        System.out.println(tbt.getHeight(tree));

//        System.out.println(tbt.getKLevelSize(null, 1));

//        tbt.getLeafSize1(tree);
//        System.out.println(tbt.leafSize);
//        System.out.println(tbt.getLeafSize2(tree));

//        tbt.getSize1(tree);
//        System.out.println(tbt.size);
//        System.out.println(tbt.getSize2(tree));

//        tbt.preOrderTraversal(tree);
//        System.out.println();
//        tbt.inOrderTraversal(tree);
//        System.out.println();
//        tbt.postOrderTraversal(tree);

//        System.out.println();
//        List<Character> list = tbt.preOrderTraversal1(tree);
//        for (Character character:list) {
//            System.out.print(character);
//        }
    }
}
